package com.ssm.pre.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.pre.service.FaultService;
import com.ssm.util.object.InputObject;
import com.ssm.util.object.OutputObject;

@Controller
public class FaultController {
	
	@Autowired
	private FaultService faultService;
	
	/**
	 * 查詢故障類型列表
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FaultController/queryFaultList")
	@ResponseBody
	public void queryFaultList(InputObject inputObject ,OutputObject outputObject) throws Exception{
		faultService.queryFaultList(inputObject, outputObject);
	}
	
	/**
	 * 增加故障類型
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FaultController/addFault")
	@ResponseBody
	public void addFault(InputObject inputObject ,OutputObject outputObject) throws Exception{
		faultService.addFault(inputObject, outputObject);
		
	}
	
	/**
	 * 刪除故障類型
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FaultController/deleteFaultById")
	@ResponseBody
	public void deleteFaultById(InputObject inputObject ,OutputObject outputObject) throws Exception{
		faultService.deleteFaultById(inputObject, outputObject);
		
	}
	/**
	 * 修改故障類型
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FaultController/updateFault")
	@ResponseBody
	public void updateFault(InputObject inputObject ,OutputObject outputObject) throws Exception{
		faultService.editFault(inputObject, outputObject);
	}
	
	/**
	 * 根据ID查询一条故障類型
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FaultController/queryFaultOneById")
	@ResponseBody
	public void queryFaultOneById(InputObject inputObject ,OutputObject outputObject) throws Exception{
		faultService.queryFaultOneById(inputObject, outputObject);
	}

	/**
	 * 查询所有的故障类型名称
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FaultController/queryFaultByName")
	@ResponseBody
	public void queryFaultByName(InputObject inputObject ,OutputObject outputObject) throws Exception{
		faultService.queryFaultByName(inputObject, outputObject);
	}
}
